CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# set project name
PROJECT (MITM_PROXY)

#################################################################################################
# set C/CXX flags
#################################################################################################
# for release 
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall -Wextra -g0")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -Wextra -g0")
SET (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS})
SET (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS})
# for debug
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2 -Wall -Wextra -g")
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2 -Wall -Wextra -g")
#################################################################################################
# set linker flags
IF (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
	SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s")
	SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -s")
	SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s")
ENDIF ()	
#################################################################################################

# common include directory
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}/extra/contrib/build/include/)

# common link directory
LINK_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}/extra/contrib/build/lib/)

# add 3rd party library
ADD_SUBDIRECTORY (./extra/contrib)

# add the main target
ADD_SUBDIRECTORY (./mitm)
